<html>
<head>
	<meta charset="UTF-8">
	<title>JS时间对象--控制跳转</title>
</head>
<body>
	<div id="showtime">显示时间...</div>
	删除成功，页面将在
	<span id="span"style="color:red;font-size: 30px;"></span>
	秒后跳转，如果没有跳转<br>
	<a href="img.html">请点击这里</a><hr />
</body>
<script type="text/javascript">
	var sum=5;
	window.onload=function(){
		document.getElementById("span").innerHTML=sum;
	}
	function getInfor(){
		sum--;
		document.getElementById("span").innerHTML=sum;
		if(sum < 1){
			window.location.href='jstime2.html';
		}
	}
	setInterval("getInfor()",1000);
	
	function getDate(){
	    var now = new Date();
	    var year = now.getFullYear();
	    var month = now.getMonth() + 1 < 10 ? "0" + (now.getMonth() + 1) : now.getMonth() + 1;
	    var day = now.getDate() < 10 ? "0" + now.getDate() : now.getDate();
	    var weeks=["日","一","二","三","四","五","六"];
		var week=now.getDay();
	    var hour = now.getHours()< 10 ? "0" + now.getHours() : now.getHours();
	    var minute = now.getMinutes()< 10 ? "0" + now.getMinutes() : now.getMinutes();
	    var second = now.getSeconds()< 10 ? "0" + now.getSeconds() : now.getSeconds();
	    return year+"-"+month+"-"+day+" 星期"+weeks[week]+" "+hour+":"+minute+":"+second;
	}
	function inhtml(){
		var str = getDate();
		document.getElementById("showtime").innerHTML=str;
	}
	setInterval("inhtml()",1000);
	
</script>
</html>